package com.coocaa.ops.admin.base.validator;

import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @author bijiahao
 * @date : 2018/8/2.
 * @description: 新增-编辑-创建副本-副本编辑 判断
 *
 */
public final class NewAddOrEditValidator {

    /**
     * 是否普通编辑-当前数据编辑
     *
     * @param dbVersion
     * @param inputVersion
     * @return
     */
    public static boolean isCurrentEdit(Integer dbVersion, Integer inputVersion) {
        return Objects.equals(dbVersion, inputVersion);
    }

    /**
     * 是否创建副本
     *
     * @param resourceId
     * @param currentVersion
     * @return
     */
    public static boolean isCreateCopy(Integer resourceId, Integer currentVersion) {
        return null != resourceId && null == currentVersion;
    }

    /**
     * 是否新增
     *
     * @param resourceId
     * @param currentVersion
     * @return
     */
    public static boolean isNewAdd(Integer resourceId, Integer currentVersion) {
        return null == resourceId;
    }

}
